<?php
include "./dbconnect.php";
$query = mysql_query("select * from `tables` where `ID` = '".$_GET[tableID]."'");
$num = mysql_num_rows($query);
if($num && mysql_result($query, 0, "lord") == ""){
	$player1_name = mysql_result($query, 0, "player1_name");
	$player2_name = mysql_result($query, 0, "player2_name");
	$player3_name = mysql_result($query, 0, "player3_name");
	$player1_p = mysql_result($query, 0, "player1_p");
	$player2_p = mysql_result($query, 0, "player2_p");
	$player3_p = mysql_result($query, 0, "player3_p");
	$lord_p = mysql_result($query, 0, "lord_p");
	if($username == $player1_name)
	mysql_query("update `tables` set `lord` = '$player1_name',`flag` = '$player1_name',`player1_p` = '".renew($player1_p.$lord_p)."',`player1_show` = '',`player2_show` = '',`player3_show` = '',`player1_tuoguan` = '0',`player2_tuoguan` = '0',`player3_tuoguan` = '0' where `ID` = '".$_GET[tableID]."'");
	if($username == $player2_name)
	mysql_query("update `tables` set `lord` = '$player2_name',`flag` = '$player2_name',`player2_p` = '".renew($player2_p.$lord_p)."',`player1_show` = '',`player2_show` = '',`player3_show` = '',`player1_tuoguan` = '0',`player2_tuoguan` = '0',`player3_tuoguan` = '0' where `ID` = '".$_GET[tableID]."'");
	if($username == $player3_name)
	mysql_query("update `tables` set `lord` = '$player3_name',`flag` = '$player3_name',`player3_p` = '".renew($player3_p.$lord_p)."',`player1_show` = '',`player2_show` = '',`player3_show` = '',`player1_tuoguan` = '0',`player2_tuoguan` = '0',`player3_tuoguan` = '0' where `ID` = '".$_GET[tableID]."'");
}
?>